package com.leoman.systemsetting.dao;

import com.leoman.common.dao.IBaseJpaRepository;
import com.leoman.systemsetting.entity.Task;
import com.leoman.systemsetting.entity.TaskRecord;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Administrator on 2016/6/12.
 */
public interface TaskDao extends IBaseJpaRepository<Task> {

    // 根据类型获取任务
    @Query("SELECT a FROM Task a WHERE a.type = ?1")
    public Task findTaskList(Integer type);

    @Query("select a from TaskRecord a where a.userId = ?1 and a.taskId = ?2")
    public List<TaskRecord> findListByUserId(Long userId, Long taskId);
}
